package com.cjs.angularjs.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cjs.angularjs.model.PhoneInfo;

@RestController
@RequestMapping("/phone")
public class PhoneAction {

    @RequestMapping("list")
    public List<PhoneInfo> phoneList(@RequestParam Map<String, Object> params) {
        List<PhoneInfo> phones = new ArrayList<PhoneInfo>();
        for (int i = 0; i < 5; i++) {
            PhoneInfo phone = new PhoneInfo();
            phone.setId(i + 1);
            phone.setName("手机" + i);
            phone.setAge(i);
            phones.add(phone);
        }
        return phones;
    }

}
